package com.hafu.dao;

import com.hafu.model.GysInfo;
import com.hafu.util.DbUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class GysInfoDao {
    public Boolean addGYSInfo(GysInfo gys)
    {
        String sql = "insert into gysinfo(name,tel) values(?,?)";
        Connection conn = DbUtil.getConn();
        try {
            PreparedStatement preparedStatement = conn.prepareStatement(sql);
            preparedStatement.setString(1,gys.getName());
            preparedStatement.setString(2,gys.getTel());
            //执行添加sql方法
            int i = preparedStatement.executeUpdate();
            if(i>0)
            {
                System.out.println("添加成功");
                return true;
            }else return false;
        }catch (SQLException throwables){
            throwables.printStackTrace();
        }
        return false;
    }
}
